namespace :js_spec do
  desc("Executes js spec in browser")
  task :run_spec do
    puts "Please specify a file using SPEC=name without _spec.html" unless ENV['SPEC']
    system "open jsspec/specs/#{ENV['SPEC']}_spec.html" 
  end
  
  desc("Executes entire folder of js specs in browser")
  task :run_all_specs do
    specs_root = Dir.new("#{RAILS_ROOT}/jsspec/specs")
    specs_root.each{|spec| system "open jsspec/specs/#{spec}" if spec[-4, 4] == "html"}
  end
end